package it.uniroma2.art.coda.structures;

import it.uniroma2.art.coda.pearl.model.PlaceholderStruct;
import it.uniroma2.art.owlart.model.ARTURIResource;

import java.util.HashMap;
import java.util.Map;

/**
 * This class contains all the suggestion produced by a Resources Smart Suggestion Component
 * 
 * @author Andrea Turbati
 */
public class ResourcesSmartSuggesterStruct extends InterComponentObject {

	Map<PlaceholderStruct, Map<String, ARTURIResource>> placeholderToARTURIResMap;

	public ResourcesSmartSuggesterStruct() {
		placeholderToARTURIResMap = new HashMap<PlaceholderStruct, Map<String, ARTURIResource>>();
	}

	/**
	 * Add a suggestion regarding a particular placeholder, this means adding its value and an ontology
	 * resource
	 * 
	 * @param placeholder
	 *            the placeholder the suggestion is about
	 * @param featValue
	 *            the value of the placeholder
	 * @param res
	 *            the ontolgy resource associated to the value of the placeholder
	 */
	public void addLabelToARTURIResource(PlaceholderStruct placeholder, String featValue, ARTURIResource res) {
		if (!placeholderToARTURIResMap.containsKey(placeholder)) {
			placeholderToARTURIResMap.put(placeholder, new HashMap<String, ARTURIResource>());
		}
		placeholderToARTURIResMap.get(placeholder).put(featValue, res);
	}

	/**
	 * Get the map containing the placeholders, their values and the associated ontology resources
	 * 
	 * @return the map containing the placeholders, their values and the associated ontology resources
	 */
	public Map<PlaceholderStruct, Map<String, ARTURIResource>> getPlaceholderToARTURIResMap() {
		return placeholderToARTURIResMap;
	}

	/**
	 * Get the list of values and ontology resource associated to a particular placeholder
	 * 
	 * @param placeholder
	 *            the placeholder to which the values and ontology resources are associated to
	 * @return the list of values and ontology resource associated to a particular placeholder
	 */
	public Map<String, ARTURIResource> getArtResourceFromPlaceholder(PlaceholderStruct placeholder) {
		return placeholderToARTURIResMap.get(placeholder);
	}
}
